module.exports = {
  _get:function(url,data){
    var promise = new Promise((resolve,reject)=>{
      let param = data;//接受传来的参数data
      wx.request({
        url: url,
        // header:{}
        data:param,
        method:'get',
        success:function(res){
          console.log(res)
          if(res.statusCode == 200){
            resolve(res)
          }else{
            reject(res.errMsg)
          }
          
        },
        error:function(e){
          reject('网络错误')
        }
      })
    })
    return promise
  },

  _post: function (url, data) {
    var promise = new Promise((resolve, reject) => {
      let param = data;//接受传来的参数data
      wx.request({
        url: url,
        // header:{}
        data: param,
        method: 'post',
        success: function (res) {
          console.log(res)
          if (res.statusCode == 200) {
            resolve(res)
          } else {
            reject(res.errMsg)
          }

        },
        error: function (e) {
          reject('网络错误')
        }
      })
    })
    return promise
  }

}